package com.xue.springcolud.controller;

import com.xue.springcloud.pojo.Dept;
import com.xue.springcloud.service.DeptClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


import java.util.List;

@RestController
//@RequestMapping("consumer")
public class DeptConsumerController {

   @Autowired
   private DeptClientService service = null;

    @RequestMapping("/dept/get/{id}")
    public Dept get(@PathVariable("id") Long id){
        return this.service.queryById(id);
    }

    @RequestMapping("/dept/list")
    public List<Dept> list(){
        return this.service.queryAll();
    }

    @RequestMapping("/dept/add")
    public Boolean add(@RequestBody Dept dept){
        return this.service.add(dept);
    }
}
